<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script src="./axios.js"></script>
<script>
    axios.interceptors.request.use(function (config) {
        // 请求之前 可以 添加一些配置 比如 添加请求头，比如传入一些请求参数等
        return config; // 放行
    }, function (error) {
        // 请求错误的拦截
        return Promise.reject(error);
    });
    axios.interceptors.response.use(function (response) {
        // 响应成功拦截 http状态码是 2xx
        return response;
    }, function (error) {
        // 响应失败拦截 http状态码不是 2xx
        return Promise.reject(error);
    });
    const baseURL='https://api.it120.cc/conner'
    axios.get(baseURL+'/shop/goods/category/all').then(res=>{
        console.log(res)
    })
</script>

</html>